/*
 * Activity.h
 *
 *  Created on: 2021年9月6日
 *      Author: vicent-PC
 */

#ifndef MAIN_ROSE_ACTIVITY_H_
#define MAIN_ROSE_ACTIVITY_H_

#include "Surface.h"
#include "View.h"

enum ACTIVITY_STATUS{
    ACTIVITY_NOTCREATE,
    ACTIVITY_PAUSED,
    ACTIVITY_RUNING,
    ACTIVITY_STOPED,    // not visionable
    ACTIVITY_KILLED,    // not visionable
};

class Activity {
 public:
    Activity();
    virtual ~Activity();
    virtual void onCreate();    // ->Stoped
    virtual void onEvent();
    virtual void requestLayout();
    virtual void setContentView(View *view);
    virtual void onDraw();
    virtual void onStart() {}     // Stoped->Paused
    virtual void onResume() {}    // Paused -> Runing
    virtual void onPause() {}     // Runing->Paused
    virtual void onStop() {}      // Running -> Stoped
    void handleResumeActivity();
    void invalidate();

    void updateStatus(ACTIVITY_STATUS status) {
        mStatus = status;
    }
    ACTIVITY_STATUS getStatus() {return mStatus;}

 public:
    float mCanvasfps = 2.0f;  // defalut fps = 2

 private:
    ACTIVITY_STATUS mStatus = ACTIVITY_NOTCREATE;
    Surface *mSurface;
    View *mContentView = nullptr;
};

#endif /* MAIN_ROSE_ACTIVITY_H_ */
